Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htmldocck: Compare HTML tree instead of plain text html #95933

Merged
merged 1 commit into from
Apr 17, 2022

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Apr 11, 2022

This PR improves htmldocck by comparing HTML trees instead of plain text html in the case of doing a @snapshot test.

This fix the CI issue encounter in #95813 where for some unknown reason one of the attributes is not always at the same place.

The code is largely based on https://github.com/formencode/formencode/blob/3a1ba9de2fdd494dd945510a4568a3afeddb0b2e/formencode/doctest_xml_compare.py#L72-L120 which is behind MIT License. The comparison function is straightforward except for the text_compare function which does some weird stuff that we may want to simply reduce to a plain old comparison.

r? @GuillaumeGomez

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 11, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 11, 2022
@GuillaumeGomez
Copy link
Member

I don't think this is a good idea. We want to check the generated HTML as is, not that the attributes look like what we want. The problem lies in your PR I think.

@Urgau
Copy link
Member Author

Urgau commented Apr 11, 2022

Fair enough. Closing this.

@Urgau Urgau closed this Apr 11, 2022
@Urgau Urgau reopened this Apr 16, 2022
@GuillaumeGomez
Copy link
Member

So the best solution would be to compare the HTML content directly but it's currently not possible with the tool we use. This will at least prevent random sorting bugs. Thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 16, 2022

📌 Commit 7cc043333ca63e91966b69dca2d1254918a91c1c has been approved by GuillaumeGomez

@Urgau

This comment was marked as duplicate.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 16, 2022
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member

@bors: r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 16, 2022
@Urgau Urgau force-pushed the rustdoc-htmldocck-tree-compare branch from 7cc0433 to 4cc2261 Compare April 16, 2022 16:22
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the rustdoc-htmldocck-tree-compare branch from 4cc2261 to e6a8720 Compare April 16, 2022 16:32
@GuillaumeGomez
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 16, 2022

📌 Commit e6a8720 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 16, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 16, 2022
…e, r=GuillaumeGomez

htmldocck: Compare HTML tree instead of plain text html

This PR improves `htmldocck` by comparing HTML trees instead of plain text html in the case of doing a ``@snapshot`` test.

This fix the [CI issue](https://github.com/rust-lang-ci/rust/runs/5964305020?check_suite_focus=true) encounter in rust-lang#95813 where for some unknown reason one of the attributes is not always at the same place.

The code is largely based on https://github.com/formencode/formencode/blob/3a1ba9de2fdd494dd945510a4568a3afeddb0b2e/formencode/doctest_xml_compare.py#L72-L120 which is behind MIT License. The comparison function is straightforward except for the `text_compare` function which does some weird stuff that we may want to simply reduce to a plain old comparison.

r? `@GuillaumeGomez`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 17, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#95346 (Stablize `const_extern_fn` for "Rust" and "C")
 - rust-lang#95933 (htmldocck: Compare HTML tree instead of plain text html)
 - rust-lang#96105 (Make the debug output for `TargetSelection` less verbose)
 - rust-lang#96112 (Strict provenance lint diagnostics improvements)
 - rust-lang#96119 (update Miri)
 - rust-lang#96124 (to_digit tweak)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0b43f70 into rust-lang:master Apr 17, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 17, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 17, 2022
…=GuillaumeGomez

Fix snapshot --bless not working anymore in htmldocck

I broke it in rust-lang#95933

r? `@GuillaumeGomez`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 18, 2022
…=GuillaumeGomez

Fix snapshot --bless not working anymore in htmldocck

I broke it in rust-lang#95933

r? ``@GuillaumeGomez``
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 18, 2022
…=GuillaumeGomez

Fix snapshot --bless not working anymore in htmldocck

I broke it in rust-lang#95933

r? ```@GuillaumeGomez```
@Urgau Urgau deleted the rustdoc-htmldocck-tree-compare branch May 5, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants